# -*- coding: utf-8 -*-
from datetime import timedelta
from jms.dwd.tab.dwd_barscan_collect_dt import jms_dwd__dwd_barscan_collect_dt
from jms.dwd.tab.dwd_barscan_sign_dt import jms_dwd__dwd_barscan_sign_dt
from utils.operators.spark_sql_operator import SparkSqlOperator

jms_dws__dws_actual_aging_sign_dt__prior_actual_sign = SparkSqlOperator(
    task_id='jms_dws__dws_actual_aging_sign_dt__prior_actual_sign',
    email='chenhongping@yl-scm.com',
    pool_slots=4,
    master='yarn',
    name='jms_dws__dws_actual_aging_sign_dt__prior_actual_sign_{{ execution_date | date_add(1) | cst_ds }}',
    sql='jms/dws/dws_actual_aging_sign_dt/prior_actual_sign.hql',
    executor_cores=2,
    executor_memory='3G',
    num_executors=6,
    conf={'spark.dynamicAllocation.enabled'                  : 'true',
          'spark.shuffle.service.enabled'                    : 'true',
          'spark.dynamicAllocation.maxExecutors'             : 16,
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 30,
          'spark.sql.sources.partitionOverwriteMode'         : 'dynamic',
          'spark.executor.memoryOverhead'                    : '1G',
          },
    hiveconf={'hive.exec.dynamic.partition'             : 'true',  # 动态分区
              'hive.exec.dynamic.partition.mode'        : 'nonstrict',
              'hive.exec.max.dynamic.partitions'        : 300,  # 最大分区
              'hive.exec.max.dynamic.partitions.pernode': 300,  # 最大分区
              },
    yarn_queue='pro',
    execution_timeout=timedelta(minutes=80),
)

jms_dws__dws_actual_aging_sign_dt__prior_actual_sign << [jms_dwd__dwd_barscan_collect_dt,jms_dwd__dwd_barscan_sign_dt,]
